package vista;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;

import util.Utilidades;

import modelo.Sucursal;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class DlgSesion extends javax.swing.JDialog {
	private JTextField txtUsuario;
	private JLabel lblUsuario;
	private JPasswordField txtpPasword;
	private JButton btAceptar;
	private JButton btSalir;
	private JLabel lblPassword;

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}


	/**
	* Auto-generated main method to display this JDialog
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrame frame = new JFrame();
				DlgSesion inst = new DlgSesion(frame);
				inst.setVisible(true);
			}
		});
	}
	
	public DlgSesion(JFrame frame) {
		super(frame);
		initGUI();
	}
	
	private void initGUI() {
		try {
			{
				getContentPane().setLayout(null);
				this.setTitle("Inicio de Secion");
				{
					txtUsuario = new JTextField();
					getContentPane().add(txtUsuario);
					txtUsuario.setBounds(121, 17, 196, 28);
				}
				{
					lblUsuario = new JLabel();
					getContentPane().add(lblUsuario);
					lblUsuario.setText("Usuario:");
					lblUsuario.setFont(new java.awt.Font("Tahoma",1,11));
					lblUsuario.setBounds(30, 24, 93, 14);
				}
				{
					lblPassword = new JLabel();
					getContentPane().add(lblPassword);
					lblPassword.setText("Password:");
					lblPassword.setFont(new java.awt.Font("Tahoma",1,11));
					lblPassword.setBounds(30, 64, 93, 14);
				}
				{
					txtpPasword = new JPasswordField();
					getContentPane().add(txtpPasword);
					txtpPasword.setBounds(121, 58, 197, 28);
				}
				{
					btSalir = new JButton();
					getContentPane().add(btSalir);
					btSalir.setText("Salir");
					btSalir.setIcon(new ImageIcon(getClass().getClassLoader().getResource("iconos/Salir.gif")));
					btSalir.setVerticalTextPosition(JButton.BOTTOM);
					btSalir.setHorizontalTextPosition(JButton.CENTER);
					btSalir.setBounds(262, 106, 79, 40);
					
				}
				{
					btAceptar = new JButton();
					getContentPane().add(btAceptar);
					btAceptar.setText("Aceptar");
					btAceptar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("iconos/Aceptar.png")));
					btAceptar.setVerticalTextPosition(JButton.BOTTOM);
					btAceptar.setHorizontalTextPosition(JButton.CENTER);
					btAceptar.setBounds(164, 106, 79, 40);
					
				}
			}
			this.setSize(373, 201);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	DlgSesion dses=this;
	public void mostrar(JDialog dialog) {
		darFormatos();
		btAceptar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			
			}
		});
	
		btSalir.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				dses.dispose();
			}
		});
	
	}
	
	public void darFormatos(){ 
		
		Utilidades.convertirMayuscula(txtUsuario);
		Utilidades.convertirMayuscula(txtpPasword);
		
		
	}

}
